package com.cy.pj.sys.service.impl;

import com.cy.pj.sys.dao.SysNoticeDao;
import com.cy.pj.sys.pojo.SysNotice;
import com.cy.pj.sys.service.SysNoticeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class SysNoticeServiceImpl implements SysNoticeService {

    private static final Logger log= LoggerFactory.getLogger(SysNoticeServiceImpl.class);

    @Autowired
    private SysNoticeDao sysNoticeDao;

    @Override
    public int saveNotice(SysNotice notice) {
        int rows = sysNoticeDao.insertSysnotice(notice);
        return rows;
    }

    @Override
    public List<SysNotice> findNotices(SysNotice notice) {
        log.debug("start: {}",System.currentTimeMillis());
        List<SysNotice> list = sysNoticeDao.selectNotices(notice);
        log.debug("end: {}",System.currentTimeMillis());
        return list;
    }

    @Override
    public int deleteById(Long... ids) {
        int rows = sysNoticeDao.deleteById(ids);
        return rows;
    }

    @Override
    public SysNotice findById(Long id) {
        SysNotice sysNotice = sysNoticeDao.selectById(id);
        return sysNotice;
    }

    @Override
    public int updateNotice(SysNotice notice) {
        int rows = sysNoticeDao.updateSysNotice(notice);
        return rows;
    }
}
